home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / IntroBro2.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.9 KB  |  130 lines

  1. class classes.bro.IntroBro2
  2. {
  3.    var x;
  4.    var y;
  5.    var clip;
  6.    var dir;
  7.    var oldDir;
  8.    var c = 0;
  9.    var xMov = 0;
  10.    var yMov = 0;
  11.    var xA = 0;
  12.    var yA = 0;
  13.    var state = "walk";
  14.    var f2 = "working";
  15.    function IntroBro2(px, py)
  16.    {
  17.       this.x = px;
  18.       this.y = py;
  19.       this.clip = _root.attachMovie("introBro2","introBro2Clip",90600);
  20.       this.clip._x = this.x;
  21.       this.clip._y = this.y;
  22.       this.clip.gotoAndStop("work");
  23.       this.dir = "work";
  24.    }
  25.    function startGame()
  26.    {
  27.       if(this.dir == "work")
  28.       {
  29.          this.y += 3;
  30.          this.x = 558 + this.clip.work.xTracker._x;
  31.       }
  32.       else if(this.dir == "cooler")
  33.       {
  34.          this.x = 678 + this.clip.cooler.xTracker._x;
  35.       }
  36.       this.f2 = "";
  37.       _root.introOverlay.redComp.gotoAndStop(2);
  38.       this.dir = "L";
  39.       this.xMov = -5;
  40.    }
  41.    function working()
  42.    {
  43.       if(random(2000) > 1998)
  44.       {
  45.          if(!_root.bro1Cooler)
  46.          {
  47.             _root.bro2Cooler = true;
  48.             this.x = 558 + this.clip.work.xTracker._x;
  49.             this.y += 3;
  50.             _root.introOverlay.redComp.gotoAndStop(2);
  51.             this.dir = "R";
  52.             this.xMov = 3;
  53.             this.f2 = "goingToCooler";
  54.          }
  55.       }
  56.    }
  57.    function goingToCooler()
  58.    {
  59.       if(this.x >= 678)
  60.       {
  61.          this.x = 678;
  62.          this.xMov = 0;
  63.          this.dir = "cooler";
  64.          this.f2 = "cooler";
  65.       }
  66.    }
  67.    function cooler()
  68.    {
  69.       if(this.clip.cooler.end)
  70.       {
  71.          this.x = 597;
  72.          this.dir = "L";
  73.          this.xMov = -3;
  74.          this.f2 = "gotoWork";
  75.       }
  76.    }
  77.    function gotoWork()
  78.    {
  79.       if(this.x <= 555)
  80.       {
  81.          this.y -= 3;
  82.          _root.bro2Cooler = false;
  83.          this.x = 480;
  84.          this.dir = "work";
  85.          this.xMov = 0;
  86.          this.f2 = "working";
  87.       }
  88.    }
  89.    function punchOut()
  90.    {
  91.       this.xMov = 0;
  92.       this.clip._x = 264;
  93.       this.clip.body.gotoAndPlay("punchOut");
  94.       _root.coins.addTo(7);
  95.       _root.audio.playLevel3("coin1",_root.randRange(21,24));
  96.    }
  97.    function exit()
  98.    {
  99.       _root.introBro1.gotoPunchOut();
  100.       _root.bro1Punch = true;
  101.       this.clip.body.gotoAndPlay("walk");
  102.       this.x = 240;
  103.       this.xMov = -5;
  104.       this.f2 = "exiting";
  105.       var _loc3_ = _root.attachMovie("introBroMask","introBroMaskClip",90605);
  106.       _loc3_._x = 111;
  107.       _loc3_._y = 471;
  108.       this.clip.setMask(_loc3_);
  109.       this.clip._alpha = 120;
  110.    }
  111.    function exiting()
  112.    {
  113.       this.clip._alpha -= 3;
  114.    }
  115.    function main()
  116.    {
  117.       this[this.f2]();
  118.       if(this.oldDir != this.dir)
  119.       {
  120.          this.clip.gotoAndStop(this.dir);
  121.          this.clip.body.gotoAndPlay(this.state);
  122.       }
  123.       this.oldDir = this.dir;
  124.       this.x += this.xMov + this.xA;
  125.       this.y += this.yMov + this.yA;
  126.       this.clip._x = this.x;
  127.       this.clip._y = this.y;
  128.    }
  129. }
  130.